package cn.tedu.spring.teacher;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * Author：程Sir
 * Name： SpringTest01
 * Content:
 */
public class TeacherTest {
    AnnotationConfigApplicationContext acac;
    @Test
    public void test(){
        Teacher teacher1 = acac.getBean("teacher",Teacher.class);
        Teacher teacher2 = acac.getBean("teacher",Teacher.class);
        teacher2.setName("熊大");
        System.out.println(teacher1);
        System.out.println(teacher2);

        System.out.println(teacher1 == teacher2);
    }
    @Before
    public void init(){
       acac = new AnnotationConfigApplicationContext(TeacherConfig.class);
        System.out.println("spring容器初始化....");

    }
    @After
    public void destory(){
        acac.close();
    }
}
